const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;
let configs = process.env.NODE_ENV == 'production' ? require('./config/config.prod') : require('./config/config.dev');
const conn = mongoose.createConnection(configs.dbUrl, { useNewUrlParser: true, useUnifiedTopology: true });
const UserModel = conn.model('User', new Schema({
    userid: { type: String },//邮箱
    name: { type: String },
    mail: { type: String, required: true },//邮箱
    password: { type: String, required: true },//密码
    mobile: { type: String, required: true },//手机号
    avatar: { type: String, required: true },//头像
    currentAuthority: { type: String, required: true }//当前用户的权限
}));

module.exports = {
    UserModel
}
